
#ifdef GL_ES
precision mediump float;
#endif

const float PI=3.1415926535;

uniform vec2 u_resolution;
uniform float u_time;

float rectshaper(vec2 position,vec2 scale){
    scale=vec2(.5)-scale*.5;
    vec2 shaper=vec2(step(scale.x,position.x),step(scale.y,position.y));
    shaper*=vec2(step(scale.x,1.-position.x),step(scale.y,1.-position.y));
    return shaper.x*shaper.y;
}

mat2 rorate(float angle){
    float c= cos(angle);
    float s= sin(angle);
    return mat2(c,-s,s,c);
}



void main(){
    vec2 coord=gl_FragCoord.xy/u_resolution;
    vec3 color=vec3(0.);
    
    coord -= 0.5;
    coord = rorate(PI*sin(u_time))*coord;
    coord += 0.5;
    float rectangle=rectshaper(coord,vec2(.3,.3));
   

    color += vec3(rectangle);
    gl_FragColor=vec4(color,1.);
}